<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/manage/common/taglibs.jsp"%>

<script type="text/javascript">

function manage_user_editform_onSubmit(){
	<c:if test="${action=='create'}">
	var isValid = $(this).form('validate');
	if(!isValid){
		return false;
	}
	//自定义检查合法性
	if($('#manage_user_passwd').val() != $('#manage_user_confirmPasswd').val()){
		$.messager.alert('提示', '两次密码输入不一致');
		return false;
	}
	return true;	
	</c:if>
	<c:if test="${action=='edit'}">
	return $(this).form('validate');
	</c:if>
}


</script>

<div align="center">
    <form id="manage_user_editform" 
    action="${pageContext.request.contextPath}/manage/system/user/${action=='create'?'saveJson':'updateJson'}.html" method="post">
      <jodd:form bean="user" scope="request">
        <input name="id" type="hidden" />
        <table class="tableForm">
          <tr>
            <th style="width: 80px;">登录名称</th>
            <td>
            <c:if test="${action == 'create'}">
            <input name="loginid" type="text" class="easyui-validatebox" data-options="required:true" /></td>
            </c:if>
            <c:if test="${action == 'edit'}">${user.loginid}</c:if>
          </tr>        
          <c:if test="${action == 'create'}">
          <tr>
            <th>密码</th>
            <td><input name="passwd" id="manage_user_passwd" type="password" validType="length[6,12]" class="easyui-validatebox" data-options="required:true" style="width: 150px;" /></td>
          </tr>
          <tr>
            <th>确认密码</th>
            <td><input name="confirmPasswd" id="manage_user_confirmPasswd" validType="equals['#manage_user_passwd']" type="password" class="easyui-validatebox" data-options="required:true" style="width: 150px;" /></td>
          </tr>
          </c:if>
          <tr>
            <th style="width: 80px;">姓名</th>
            <td><input name="name" type="text" class="easyui-validatebox" data-options="required:true" /></td>
          </tr>          
          <tr>
            <th>E-Mail</th>
            <td><input name="email" type="text" class="easyui-validatebox" validType="email" data-options="required:true" style="width: 150px;" /></td>
          </tr>
          <tr>
            <th>类型</th>
            <td><select name="userType" style="width: 150px;" class="easyui-combobox">
                <c:forEach items="${allUserTypes}" var="e" varStatus="s">
                  <option value="${e.key}" ${s.index == 0?'selected':''}>${e.value}</option>
                </c:forEach>
            </select></td>
          </tr>
          <tr>
            <th>状态</th>
            <td><select name="status" style="width: 150px;" class="easyui-combobox">
                <c:forEach items="${allStatus}" var="e">
                  <option value="${e.key}">${e.value}</option>
                </c:forEach>
            </select></td>
          </tr>
          <tr>
            <th>所属角色</th>
            <td><select name="role" style="width: 150px;" class="easyui-combobox">
                <c:forEach items="${allRoles}" var="e">
                  <option value="${e.id}">${e.name}</option>
                </c:forEach>
            </select></td>
          </tr>
          <tr>
            <th>备注</th>
            <td><textarea name="descn" rows="3" cols="40" class="easyui-validatebox"></textarea></td>
          </tr>
        </table>
      </jodd:form>
    </form>
</div>